/**
 * Created by sunyx on 2016/9/28.
 */
import React from 'react';
import {get} from '../../logics/rpc';
import ObjectTable from '../../components/ObjectTable';
import {Link} from 'react-router';

const columns = [{
  title: 'ID',
  dataIndex: 'id',
  width: 60,
}, {
  title: '销售渠道类型',
  dataIndex: 'type',
}, {
  title: '销售渠道订单号',
  dataIndex: 'seq',
}, {
  title: '商品ID',
  dataIndex:'goodId'
}, {
  title: '作品ID',
  dataIndex:'advertiseId',
},  {
  title: '总订单价格',
  dataIndex:'fee',
},  {
  title: '创作者收入',
  dataIndex:'award',
},{
  title:'发生时间',
  dataIndex:'createdAt',
}];

export default class EarnList extends React.Component{
  componentWillReceiveProps(newProps) {
    this.refs.table.refresh();
  }
  fetchData = (params) => get(`/admin/user/${this.props.params.id}/earned`, params);
  render() {
    return (
      <ObjectTable
        columns={columns}
        fetchData={this.fetchData}
        ref="table"
      />
    );
  }
}
